<template>
	<view class="container">
		<view class="tui-page__hd">
			<view class="tui-page__title">cubic-bezier</view>
			<view class="tui-page__desc">贝塞尔曲线，常用场景如添加购物车</view>
		</view>
		<view class="tui-page__bd tui-page__spacing">
			<!--左下曲线-->
			<view class="tui-title">左下曲线</view>
			<view class="tui-goods__list">
				<tui-list-cell :hover="false" padding="30rpx" v-for="(item, index) in 2" :key="index">
					<view class="tui-goods__item">
						<image :src="webURL + 'img_cafe_1.jpg'" class="tui-goods__img"></image>
						<view class="tui-goods__info">
							<view class="tui-goods__title">卡布奇诺</view>
							<view>￥17.00</view>
						</view>
						<view class="tui-add__box">
							<image src="/static/images/template/cafe/plus_circle.png" class="tui-plus__img"></image>
							<tui-cubic-bezier
								:windowWidth="windowWidth"
								:windowHeight="windowHeight"
								left="8rpx"
								top="8rpx"
								:position="{ left: 44, bottom: 54 }"
								direction="bottom"
								:index="index"
								@click="addCart"
							></tui-cubic-bezier>
						</view>
					</view>
				</tui-list-cell>
			</view>
			<!--右下列表-->
			<view class="tui-title">右下曲线</view>
			<view class="tui-goods__list">
				<tui-list-cell :hover="false" padding="30rpx" v-for="(item, index) in 2" :key="index">
					<view class="tui-goods__item tui-between">
						<view class="tui-add__box tui-left">
							<image src="/static/images/template/cafe/plus_circle.png" class="tui-plus__img"></image>
							<tui-cubic-bezier
								width="48rpx"
								height="48rpx"
								:windowWidth="windowWidth"
								:windowHeight="windowHeight"
								left="4rpx"
								top="4rpx"
								:position="{ right: 44, bottom: 54 }"
								custom
							>
								<image :src="webURL + 'img_cafe_2.jpg'" class="tui-badge__img"></image>
							</tui-cubic-bezier>
						</view>

						<view class="tui-goods__info">
							<view class="tui-goods__title">美式咖啡（8折优惠）</view>
							<view>￥17.00</view>
						</view>
						<image :src="webURL + 'img_cafe_2.jpg'" class="tui-goods__img tui-mr__0"></image>
					</view>
				</tui-list-cell>
				<tui-list-cell :hover="false" padding="30rpx">
					<view class="tui-goods__item">
						<image :src="webURL + 'img_cafe_1.jpg'" class="tui-goods__img"></image>
						<view class="tui-goods__info">
							<view class="tui-goods__title">卡布奇诺</view>
							<view>￥17.00</view>
						</view>
						<view class="tui-add__box">
							<image src="/static/images/template/cafe/plus_circle.png" class="tui-plus__img"></image>
							<tui-cubic-bezier
								:windowWidth="windowWidth"
								:windowHeight="windowHeight"
								left="8rpx"
								top="8rpx"
								:position="{ right: 44, bottom: 54 }"
							></tui-cubic-bezier>
						</view>
					</view>
				</tui-list-cell>
			</view>

			<view class="tui-title">左上曲线</view>
			<view class="tui-goods__list">
				<tui-list-cell :hover="false" padding="30rpx">
					<view class="tui-goods__item">
						<image :src="webURL + 'img_cafe_1.jpg'" class="tui-goods__img"></image>
						<view class="tui-goods__info">
							<view class="tui-goods__title">卡布奇诺</view>
							<view>￥17.00</view>
						</view>
						<view class="tui-add__box">
							<image src="/static/images/template/cafe/plus_circle.png" class="tui-plus__img"></image>
							<tui-cubic-bezier
								:windowWidth="windowWidth"
								:windowHeight="windowHeight"
								left="8rpx"
								top="8rpx"
								direction="top"
								:position="{ top: 44, left: 44 }"
							></tui-cubic-bezier>
						</view>
					</view>
				</tui-list-cell>
			</view>

			<view class="tui-title">右上曲线</view>
			<view class="tui-goods__list">
				<tui-list-cell :hover="false" padding="30rpx">
					<view class="tui-goods__item tui-between">
						<view class="tui-add__box tui-left">
							<image src="/static/images/template/cafe/plus_circle.png" class="tui-plus__img"></image>
							<tui-cubic-bezier
								:windowWidth="windowWidth"
								:windowHeight="windowHeight"
								left="8rpx"
								top="8rpx"
								direction="up"
								:position="{ top: 44, right: 44 }"
							></tui-cubic-bezier>
						</view>

						<view class="tui-goods__info">
							<view class="tui-goods__title">美式咖啡（8折优惠）</view>
							<view>￥17.00</view>
						</view>
						<image :src="webURL + 'img_cafe_2.jpg'" class="tui-goods__img tui-mr__0"></image>
					</view>
				</tui-list-cell>
			</view>

			<view class="tui-bags__box tui-bag__1"><image src="/static/images/template/cafe/shopping_bag.png" class="tui-bags__img"></image></view>
			<view class="tui-bags__box tui-bag__2"><image src="/static/images/template/cafe/shopping_bag.png" class="tui-bags__img"></image></view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			windowWidth: 375,
			windowHeight: 667,
			webURL: 'https://thorui.cn/extend/cafe/'
		};
	},
	onLoad() {
		setTimeout(() => {
			let sys = uni.getSystemInfoSync();
			this.windowWidth = sys.windowWidth;
			this.windowHeight = sys.windowHeight;
		}, 50);
	},
	methods: {
		addCart(e) {
			console.log(e);
		}
	}
};
</script>

<style>
.container {
	padding-bottom: 200px;
}
/*z-index 的值设在20~990之间*/
.tui-bags__box {
	width: 48px;
	height: 48px;
	background-color: #ffffff;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.1);
	position: fixed;
	z-index: 30;
}

.tui-bags__img {
	width: 24px;
	height: 24px;
}

.tui-bag__1 {
	bottom: 30px;
	left: 20px;
}

.tui-bag__2 {
	bottom: 30px;
	right: 20px;
}

.tui-goods__item {
	width: 100%;
	display: flex;
	align-items: center;
	font-size: 26rpx;
}

.tui-goods__img {
	width: 140rpx;
	height: 140rpx;
	border-radius: 8rpx;
	flex-shrink: 0;
	margin-right: 16rpx;
	background-color: #f8f8f8;
}

.tui-add__box {
	position: relative;
	margin-left: auto;
	flex-shrink: 0;
}

.tui-left {
	margin-left: 0;
	margin-right: 30rpx;
}

.tui-plus__img {
	width: 56rpx;
	height: 56rpx;
	margin-left: auto;
}

.tui-goods__info {
	width: 56%;
	height: 132rpx;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	align-content: space-between;
}

.tui-goods__title {
	width: 100%;
	font-size: 32rpx;
	line-height: 32rpx;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.tui-between {
	justify-content: space-between;
}

.tui-mr__0 {
	margin-right: 0;
}
.tui-title {
	width: 100%;
	color: #555;
	font-size: 28rpx;
	line-height: 28rpx;
	font-weight: 500;
	padding: 30rpx 30rpx 20rpx;
	box-sizing: border-box;
}
.tui-badge__img {
	width: 48rpx;
	height: 48rpx;
}
</style>
